package com.itstherules.jmsunit.loaders;

import java.io.FileNotFoundException;


public final class SoapLoader implements FileLoader {

	private FileLoader delegate;

	public SoapLoader() {
		this.delegate = new XmlLoader();
	}
	
	public final String load(String file) throws FileNotFoundException {
		String lineSeparator = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		buffer.append("<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">");
		buffer.append(lineSeparator);
		buffer.append("	<SOAP-ENV:Header/>");
		buffer.append(lineSeparator);
		buffer.append("	<SOAP-ENV:Body>"); 
		buffer.append(lineSeparator);
		buffer.append(delegate.load(file));
		buffer.append(lineSeparator);
		buffer.append("	</SOAP-ENV:Body>"); 
		buffer.append(lineSeparator);
		buffer.append("</SOAP-ENV:Envelope>");
		return buffer.toString();
	}

}
